﻿// chrnlk

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Mail;

namespace FreightSoft.BusinessLogicLayer.ROUTE
{
    public class Mail
    {
        public void Send(MailMessage mail)
        {
            SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

            mail.From = new MailAddress("notification.msc@gmail.com");
            
            SmtpServer.Port = 587;
            SmtpServer.Credentials = new System.Net.NetworkCredential("notification.msc", "freightsoft");
            SmtpServer.EnableSsl = true;

            //SmtpServer.Send(mail);
        }

        public void SendOrderReady(string toAddress, string orderId)
        {
             MailMessage mail = new MailMessage();
             mail.To.Add(toAddress);
             mail.Subject = "Msc Notification on order " + orderId;
             mail.Body = @"Your payments and goods were reveived. Order is beign processing for shipping.
                            Thank you,
                            MSC.";

             Send(mail);
        }

        public void SendOrderShipped(string toAddress, string orderId)
        {
            MailMessage mail = new MailMessage();
            mail.To.Add(toAddress);
            mail.Subject = "Msc Notification on order " + orderId;
            mail.Body = @"Your Order is shipping now.                          
                          Thank you,
                          MSC."; 

            Send(mail);
        }


        public void SendOrderArrived(string toAddress)
        {
            MailMessage mail = new MailMessage();
            mail.To.Add(toAddress);
            mail.Subject = "Test Mail";
            mail.Body = @"Your Order is reveived to its destination
                          Thank you,
                          MSC.";
            Send(mail);
        }

    }
}
